from datetime import datetime


class Thoroughbred:
    def __init__(self, mother, father, birthyear):
        # 私有属性
        self.__mother = mother  # 母亲
        self.__father = father  # 父亲
        self.__birthyear = birthyear  # 出生年份

    def getCurrentAge(self):
        """计算并返回当前年龄"""
        current_year = datetime.now().year
        return current_year - self.__birthyear

    def getFather(self):
        """获取父亲信息"""
        return self.__father

    def getMother(self):
        """获取母亲信息"""
        return self.__mother

    # 可选：添加设置属性的方法（如果需要修改属性）
    def setMother(self, mother):
        self.__mother = mother

    def setFather(self, father):
        self.__father = father

    def setBirthyear(self, birthyear):
        self.__birthyear = birthyear


# 测试代码
if __name__ == "__main__":
    # 创建实例
    horse = Thoroughbred("Mare A", "Stallion B", 2018)

    # 测试方法
    print(f"母亲: {horse.getMother()}")
    print(f"父亲: {horse.getFather()}")
    print(f"当前年龄: {horse.getCurrentAge()}岁")

    # 修改属性
    horse.setBirthyear(2020)
    print(f"修改出生年份后的年龄: {horse.getCurrentAge()}岁")